<template>
  <div>
    <el-cascader
      v-model="value"
      :options="cityData"
      :props="{ expandTrigger: 'hover' }"
      @change="handleChange"
    ></el-cascader>
    <el-button type="primary" @click="getInfo">获取物流信息</el-button><br />
    <el-timeline :reverse="reverse">
      <el-timeline-item
        v-for="(activity, index) in dataList"
        icon="large"
        type="primary"
        color="el-icon-more"
        :size="activity.size"
        :key="index"
        :timestamp="activity.time"
      >
        {{ activity.context }}
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script>
import cityData from '../../assets/js/citydata'

export default {
  data() {
    return {
      cityData,
      value: '',
      reverse: false,
      id: '1106975712662',
      dataList: []
    }
  },
  created() {},
  methods: {
    handleChange() {
      console.log(this.value)
    },
    async getInfo() {
      this.dataList = []
      const { data: res } = await this.$http.get(`/kuaidi/${this.id}`)
      if (res.meta.status !== 200) {
        return this.$message.error(res.meta.msg)
      }
      this.dataList = res.data
    }
  }
}
</script>

<style lang="less" scoped></style>
